<div class="layui-layout layui-layout-admin" style="padding-left: 40px;margin-top: 20px; " >
    <form class="layui-form" >
        <div class="layui-form-item"  >
            <h2 style = "text-indent:6em"> 
                修改用户【
                <font color="#104E8B" id = "uctrname" ></font>
                】作弊率
            </h2>
        </div>
         <div class="layui-form-item" >
            <label class="layui-form-label" style="width:100px;">游戏推广号：</label>
            <div class="layui-form-mid">
                <font color="#104E8B" id = "uctrlGameID"></font>
            </div>    
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label" style="width:100px;">当前作弊率：</label>
            <div class="layui-form-mid">
                <font color="#FF0000" id = "uCtrlOldCheatRate"></font>
            </div>    
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label" style="width:100px;">当前作限额：</label>
            <div class="layui-form-mid">
                <font color="#FF0000" id = "uCtrlOldCheatScore"></font>
            </div>    
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label" style="width:100px;">当前剩余作弊分数：</label>
            <div class="layui-form-mid">
                <font color="#FF0000" id = "userLeftCheatScore"></font>
            </div>    
        </div>

        <div class="layui-form-item" >
            <label class="layui-form-label"  style="width:100px;">设置作弊率：</label>
            <div class="layui-input-inline">
                   <input class="layui-input" type="number" name="uCtrlCheatRate" id="uCtrlCheatRate" autocomplete="off"  lay-verify="required"  value=""  min = "-1000" max = "1000">
            </div> 
             <div class="layui-form-mid">
                <font color="#FF0000">
                    *该值为千分比，最小值为-1000，最大值为1000，大于0表示系统作弊用户输分，小于0表示系统吐分用户赢分
                </font>
            </div> 
        
        </div>
        <div class="layui-form-item" >
            <label class="layui-form-label"  style="width:100px;">目标分数：</label>
            <div class="layui-input-inline">
                   <input class="layui-input" type="number" name="uCtrlCheatScore" id="uCtrlCheatScore" autocomplete="off"  lay-verify="required"  value=""  min = "0">
            </div> 
             <div class="layui-form-mid">
                <font color="#FF0000">
                    *该值大于0，表示调控用户的目标分数，例让用户赢或者输10000，该值就设置为10000
                </font>
            </div> 
        
        </div> 
        <div class="layui-form-item" >
            <label class="layui-form-label"  style="width:100px;">修改理由：</label>
            <div class="layui-input-block">
                    <textarea style="height:100px;width:400px" name="ctrlreson" id="ctrlreson" placeholder="请输入内容" lay-verify="required" class="layui-textarea" maxlength="127"></textarea>
            </div>
           
        </div>


        <div class="layui-form-item" >
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="useroprater">确定修改</button>
            </div>
        </div>
    </form>
</div>
<script>
var $;
    layui.config({
            base : "js/"
    }).use(['form','element','layer','jquery'],function(){
        var form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
        var $ = layui.jquery;

        ShowContlrDatas();
        form.on('submit(useroprater)', function(data){
            var szReson = document.getElementById("ctrlreson");
            var uCtrlCheatRate = document.getElementById("uCtrlCheatRate");
            var uCtrlCheatScore = document.getElementById("uCtrlCheatScore");
            if (uCtrlCheatRate.value >= -1000 && uCtrlCheatRate.value <= 1000 && uCtrlCheatScore.value > 0)
            {
          
                var form_data = {
                    'uCtrlType': [|.uCtrlType|]
                    ,'uCtrlUserID': localStorage["gameid"]
                    ,'uCtrlName': localStorage["unickname"]
                    ,'uCtrlCheatRate': uCtrlCheatRate.value
                    ,'uCtrlCheatScore': uCtrlCheatScore.value
                    ,'uCtrlReaSonStr': szReson.value
                }
                layer.confirm('你确定修改：【'+ localStorage["unickname"]+'】的作弊率吗？', function(index){
                    $.post('[|urlfor "UsersFinduserController.UserContrlInfo"|]', form_data, function (out) {
                        if (out.status == 0) {
                            layer.msg(out.message.strOKMessage,{icon: 1},function () {
                                localStorage["userCheatRate"] = out.message.uCtrlCheatRate;
                                localStorage["userCheatScore"] = out.message.uCtrlCheatScore;
                                localStorage["userLeftCheatScore"] = out.message.uCtrlCheatScore;
                                window.location.reload()
                            })
                        } else {
                            layer.msg(out.message)
                        }
                    }, "json");
                });
                return false;
             }
          
        });
    return false;
}); 
function ShowContlrDatas(){
    var uctrname =  document.getElementById("uctrname");
    uctrname.innerHTML=localStorage["unickname"];
    var uctrlGameID =  document.getElementById("uctrlGameID");
    uctrlGameID.innerHTML=localStorage["gameid"];
    var uCtrlOldCheatRate = document.getElementById("uCtrlOldCheatRate");
    uCtrlOldCheatRate.innerHTML=localStorage["userCheatRate"];
    var uCtrlOldCheatScore = document.getElementById("uCtrlOldCheatScore");
    uCtrlOldCheatScore.innerHTML=localStorage["userCheatScore"];
    var userLeftCheatScore = document.getElementById("userLeftCheatScore");
    userLeftCheatScore.innerHTML=localStorage["userLeftCheatScore"];
    
}
</script>